package com.it.utils;

import cn.hutool.core.util.ReUtil;

public class AccountValidator {
    public static boolean isValidAccount(String account) {
        // 正则表达式：只允许字母、数字和下划线
        String regex = "^[a-zA-Z0-9_]+$";
        return ReUtil.isMatch(regex, account);
    }

    public static void main(String[] args) {
        String validAccount = "abc123";
        String invalidAccount = "abc@123";

        System.out.println("账号 " + validAccount + " 是否有效: " + isValidAccount(validAccount));
        System.out.println("账号 " + invalidAccount + " 是否有效: " + isValidAccount(invalidAccount));
    }
}